<!--
 * @Author: wangshiyang
 * @Date: 2023-06-19 14:56:08
 * @LastEditors: wangshiyang
 * @LastEditTime: 2023-06-19 14:57:14
 * @Description: 请填写简介
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="referrer" content="no-referrer" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 导入依赖 -->
    <script src='https://unpkg.com/@antv/l7'></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #map {
            width: 100vw;
            height: 100vh;
        }
    </style>
</head>

<body>
    <div id="map">

    </div>
    <script>
        /* 初始化地图 */
        const { Scene, GaodeMap } = L7;
        /* L7  地理数据的可视化是基于Scene,
        map地图是L7中场景的一个属性,L7并不破话侵入地图
         */
        const scene = new Scene({
            id: "map",
            map: new GaodeMap({
                style: 'dark',
                center: [120.144689,
                    30.250433],
                pitch: 45,
                token: "3851594382e218c49865a4d6a5170b52",
                zoom:14
            }),
        })
        scene.on('loaded', () => {
            fetch(
                'https://gw.alipayobjects.com/os/bmw-prod/67130c6c-7f49-4680-915c-54e69730861d.json'
            )
                .then(data => data.json())
                .then(({ lakeData }) => {
                    console.log(lakeData)
                    const lakeLayer = new L7.PolygonLayer({ autoFit: true })
                        .source(lakeData)
                        .shape('water')
                        .color('#1E90FF')
                        .style({
                            speed: 0.4,
                        })
                        .animate(true);

                    scene.addLayer(lakeLayer);
                });
        });
    </script>
</body>

</html>